<template>
    
    <!-- 组件的模板 -->
    <div class="weui-cells">
        <a class="weui-cell weui-cell_access" href="javascript:;" @click="changePsw">
            <div class="weui-cell__bd">
                <p>修改密码</p>
            </div>
            <div class="weui-cell__ft">
            </div>
        </a>
    </div>

    <div class="button-sp-area">
        <a href="javascript:;" class="btn_logout bg-color touch com-border-bottom com-border-top" @click="loginOut">退出登录</a>
    </div> 
    <div class="contact" :style="isIphoneX?'bottom:22px;':''">
        <p>灵云{{version}}</p>
    </div>  
</template>

<script>
    /**
     *  引入工具类库 或 Native API
     *  example : import widget from 'gapi/widget'
     */
    import userCenterApi from 'clientApi/userCenterApi.js'
    import KCApiApp from 'clientApi/KCApiApp.js'
    import * as util from 'js/util.js'
    
    /**
     *  引入组件 以及 组件接口(Action)
     *  example : import Somecomponents from 'components/Somecomponents/Somecomponents'
     */

    /**
     *  组件实例对象
     */
    export default {
        components: {

        },
        data: function(){
            return{
               version:'' 
            }
        },
        computed: {
            isIphoneX: function(){
                return util.isIphoneX()
            }
        },
        vuex: {
            getters: {

            },
            actions: {

            }
        },
        methods: {
            /**
             * 初始化
             * @method init
             * @public
             * @return {Null} void
             */
            init (){
                userCenterApi.getAppVersion( (data) => {
                    this.version = data.version
                })
                
            },
            /*退出登录*/
            loginOut (){
                //埋点
                let statisticsLog_data = {
                    event_id: '设置页-退出登录',
                    // event_label: data.event_label,(预留，现在不用传此参数)
                    event_param: {
                        ca_from: 'quit',
                    }
                }
                // alert(JSON.stringify(statisticsLog_data))
                KCApiApp.statisticsLog(statisticsLog_data)

                userCenterApi.logOut();
            },
            changePsw (){
                //埋点
                let statisticsLog_data = {
                    event_id: '设置页-修改密码',
                    // event_label: data.event_label,(预留，现在不用传此参数)
                    event_param: {
                        ca_from: 'modifycode',
                    }
                }
                // alert(JSON.stringify(statisticsLog_data))
                KCApiApp.statisticsLog(statisticsLog_data)

                location.href = `dmsaas://ResetPassword`
            }
        },
        created(){

            this.init();
            
        }
        
    }

    
</script>

<!-- CSS 样式 -->
<style src="../../node_modules/weui/dist/style/weui.css"></style>
<style src="../../static/css/common.css"></style>
<style>
    div.weui-cells{margin-bottom: 10px;}
    .btn_logout {
        display: block;
        height: 48px;
        line-height: 48px;
        font-size: 16px;
        text-align: center;
    }
    div.contact{
        color: #bbb;
        width: 100%;
        position: absolute;
        bottom: 12px;
    }
    div.contact p{
        text-align: center;
    }
</style>



